#include "web/web_status_ui.h"
#include <sstream>
#include <iomanip>

std::string render_status_html(const WebStatus& status) {
    std::ostringstream oss;
    oss << "<div class='stats-row'>";
    // FPS
    oss << "<div class='stat-card'><div class='stat-label'>FPS</div><div class='stat-value' id='fps'>";
    oss << std::fixed << std::setprecision(1) << status.fps.load();
    oss << "</div></div>";
    // 检测目标数
    oss << "<div class='stat-card'><div class='stat-label'>检测目标数</div><div class='stat-value' id='obj_count'>"
        << status.total_objects.load() << "</div></div>";
    // 人员
    oss << "<div class='stat-card'><div class='stat-label'>人员</div><div class='stat-value' id='person_count'>"
        << status.person_count.load() << "</div></div>";
    // 车辆
    oss << "<div class='stat-card'><div class='stat-label'>车辆</div><div class='stat-value' id='car_count'>"
        << status.car_count.load() << "</div></div>";
    oss << "</div>";

    return oss.str();
}
